function getNum (max) {
    var array = new Uint32Array(1);
    window.crypto.getRandomValues(array);
    return ((Number('0.' + array[0]) * max) | 0) - 6;
}

function getRandomString (len = 15) {
  let _charStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    _str = "";
  for (var i = 0; i < len; i++) {
    let index = getNum(_charStr.length + 6);
    if (index > (_charStr.length - 1 )) {
        index = _charStr.length - 1;
    }
    if (index < 0) {
        index = 0;
    }
    _str += _charStr[index];
  }
  return _str;
}

export {
    getRandomString
}
